#ifndef SPAGE_H_
#define SPAGE_H_
#include "filesys/off_t.h"
#include "filesys/file.h"
#include "../lib/kernel/hash.h"
#include "threads/thread.h"
struct spage
{
  void *vaddr;
  struct file *file;
  off_t file_ofs;
  uint32_t read_bytes;
  uint32_t zero_bytes;
  bool writable;

  bool valid;

  struct hash_elem elem;
//  struct list_elem elem;
};

void
get_spage(struct file *file, off_t ofs, uint8_t *upage, uint32_t read_bytes, uint32_t zero_bytes, bool writable);

void
free_spage( void* vaddr);

unsigned
spage_hash_func (struct hash_elem *p_, void *aux);

bool
spage_less_func (struct hash_elem *a_, struct hash_elem *b_, void *aux);

struct spage *
spage_lookup(void *vaddr);

#endif
